package com.culturalCenter.dataCenter.service.impl.training;

import com.culturalCenter.dataCenter.entity.training.TrainingAssessment;
import com.culturalCenter.dataCenter.mapper.training.TrainingAssessmentMapper;
import com.culturalCenter.dataCenter.service.training.TrainingAssessmentService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author : weicai
 * @date : 16:33 2020/10/13
 */
@Service
public class TrainingAssessmentServiceImpl implements TrainingAssessmentService {

    @Resource
    private TrainingAssessmentMapper trainingAssessmentMapper;

    @Override
    public List<TrainingAssessment> getAssessment(String trainingId) {
        return trainingAssessmentMapper.queryByTrainingId(trainingId);
    }

    @Override
    public List<TrainingAssessment> getAllAssessment(String trainingProjectId) {
//        List<TrainingAssessment> trainingAssessmentList = trainingAssessmentMapper.queryByProjectId(trainingProjectId);
//        if (CollectionUtils.isNotEmpty(trainingAssessmentList)) {
//            trainingAssessmentList.stream().filter(item->item.getTargetPerformance()>item.getFinalPerformance()).forEach(item->item.setIsStandard(1));
//            for (TrainingAssessment trainingAssessment : trainingAssessmentList) {
//                if (trainingAssessment.getTargetPerformance() > trainingAssessment.getFinalPerformance()) {
//                    trainingAssessment.setIsStandard(1);
//                }
//            }
//        }
        return null;
    }

    @Override
    public List<TrainingAssessment> getAchievements(String trainingProjectId) {
        return trainingAssessmentMapper.queryAchievements(trainingProjectId);
    }

}
